package com.qfedu.buy.server.listener;

import com.qfedu.buy.common.config.RabbitMQConstantConfig;
import com.qfedu.buy.server.manager.intf.UserInitService;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @program: NeighborBuy
 * @description:
 * @author: Feri(邢朋辉)
 * @create: 2021-01-26 14:36
 */
@Component
@RabbitListener(queues = RabbitMQConstantConfig.QUEUE_USER_INIT)//对消息mq进行监听
public class UserInitQueueListener {
    @Autowired
    private UserInitService initService;//通用接口层的注入监听

    @RabbitHandler
    public void handler(Integer uid){
        if(uid>0){
            initService.saveInit(uid);
        }
    }
}